#!/bin/bash

echo "Testing environment variable and file access..."

# 设置环境变量
export PROJ_ROOT=/home/apachee/trunk/Crystal/CrystalFlowAnalyzer/a9soc

echo "PROJ_ROOT = $PROJ_ROOT"

# 检查环境变量是否设置
if [ -z "$PROJ_ROOT" ]; then
    echo "ERROR: PROJ_ROOT is not set"
    exit 1
fi

# 检查目录是否存在
if [ ! -d "$PROJ_ROOT" ]; then
    echo "ERROR: PROJ_ROOT directory does not exist: $PROJ_ROOT"
    exit 1
fi

echo "PROJ_ROOT directory exists"

# 检查文件是否存在
test_file="$PROJ_ROOT/design/usb2/src/usb2_DWC_usb3_params.v"
if [ ! -f "$test_file" ]; then
    echo "ERROR: Test file does not exist: $test_file"
    exit 1
fi

echo "Test file exists: $test_file"

echo "All tests passed!"